package com.zb.kl.common.exceptions;

public enum StatusCode {
    /**
     * code码
     */
    SUCCESS(100000, "Success"),

    // the follow code are defined follow the HTTP protocol
    E_BAD_REQUEST(200400, "Client sent an invalid request"),
    E_UNAUTHENTICATED(200401, "Client failed to authenticate with the server"),

    E_FORBIDDEN(200403, "Client does not have permission to access the requested resource"),
    E_NOT_FOUND(200404, "Requested resource does not exist"),
    E_CLOSE_PROJECT(200405, "Project has been closed"),

    E_REQUEST_TIMEOUT(200408, "Request timeout"),
    E_INTERNAL_ERROR(200500, "Generic error on the server"),
    E_NOT_IMPLEMENTED(200501, "Server does not recognize the request method"),
    E_SERVICE_UNAVAILABLE(200503, "Requested service is not available"),
    E_LACK_PARAMS(200503, "Requested lack necessary params"),

    // the follow code are defined as extensions
    E_DATA_CONVERT(210001, "Can not convert data to target type"),
    E_THING_NOT_START(210002, "Thing is not started"),


    E_RESULT_VAR_UNEFINED(300001, "Can not convert data to target type"),
    E_INVALID_PARAM(300002, "Invalid param"),


    E_UNKNOW_EXCEPTION(-1, "unknow exception.");
    private final int code;
    private final String msg;

    StatusCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return msg;
    }
}
